<div class="special-check main">
  <div class="pa-form-container shadowbox">
    <div class="container-header">
      设备检验
    </div>
    <div class="pa-form-content">
      <form class="clear" name="queryForm">
         <div class="row" style="overflow: hidden;padding-bottom: 10px;">
          <div class="pa-form-control fl">
            <label>设备名称：</label>
            <input type="text"
              ng-model="equipmentInspection.queryData.deviceName">
          </div>
          <div class="pa-form-control fl">
            <label>内部编号：</label>
            <input type="text"
              ng-model="equipmentInspection.queryData.innerNo">
          </div>
          <div class="pa-form-control fl">
            <label>设备等级：</label>
            <select id="type" name="type"
              ng-model="equipmentInspection.queryData.deviceLevel">
              <option value=""></option>
              <option value="1">一般设备</option>
              <option value="2">主要设备</option>
              <option value="4">特种设备</option>
            </select>
          </div>
          <div class="pa-form-control fl">
            <label>所属标段:</label>
            <select
              ng-model="equipmentInspection.queryData.bidId">
              <option value=""></option>
              <option value="{{item.bidId}}"
                ng-repeat ="item in equipmentInspection.sectionList">
                {{item.bidName}}
              </option>
            </select>
          </div>
          <div class="pa-form-control fl">
            <label>检测时间：</label>
            <input type="text" ng-datepicker name="startTime" required
              ng-model="equipmentInspection.queryData.startTime">
            到
            <input type="text" ng-datepicker name="endTime" required
              ng-model="equipmentInspection.queryData.endTime">
          </div>
        </div>      
        <a class="pa-float-btn reset-btn"
          ng-click="equipmentInspection.reset()">
          <i class="fa fa-repeat"></i>
          <span class="ml5">重置</span>
        </a>
        <a class="pa-float-btn query"
          ng-click="equipmentInspection.searchInformation(queryForm)">
          <i class="fa fa-search"></i>
          <span class="ml5">查询</span>
        </a>
      </form>
    </div>
  </div>
  <div class="pa-table-container shadowbox">
    <div class="operation-bar">
      <a class="pa-btn"
        ng-click="equipmentInspection.newTestCode()">  
        新增检测记录
      </a>
      <div class="table-outer" style="margin-top: 14px;">
        <form class="base-info">
          <table class="pa-table">
            <thead>
              <tr>
                <th>所属标段</th>
                <th>设备等级</th>
                <th>设备名称</th>
                <th>内部编号</th>
                <th class="time-sequence">
                  <div>检测时间</div>
                  <div class="time-sequence-btn">
                    <div class="time-sequence-box"
                      ng-click="equipmentInspection.up('check_time','0')">
                      <i class="fa fa-caret-up"></i>
                    </div>
                    <div class="time-sequence-box"
                      ng-click="equipmentInspection.up('check_time','1')">
                      <i class="fa fa-caret-down"></i>
                    </div> 
                  </div>
                </th>
                <th class="time-sequence">
                  <div>下次检测时间</div>
                  <div class="time-sequence-btn">
                    <div class="time-sequence-box"
                      ng-click="equipmentInspection.up('next_checktime','0')">
                      <i class="fa fa-caret-up"></i>
                    </div>
                    <div class="time-sequence-box"
                      ng-click="equipmentInspection.up('next_checktime','1')">
                      <i class="fa fa-caret-down"></i>
                    </div> 
                  </div>
                </th>
                <th>检测结果</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              <tr
                ng-repeat="item in equipmentInspection.equipmentInspectionItemList">
                <td>{{item.deviceInfoBean.tender}}</td>
                <td>
                  {{item.deviceInfoBean.deviceLevel== '1' ? '一般设备' : 
                 item.deviceInfoBean.deviceLevel == '2' ? '主要设备' : 
                 item.deviceInfoBean.deviceLevel == '4' ? '特种设备' : ''}}
                </td>
                <td>{{item.deviceInfoBean.deviceName}}</td>
                <td>{{item.deviceInfoBean.innerNo}}</td>
                <td>{{item.checkTime}}</td>
                <td>{{item.nextChecktime}}</td>
                <td>
                  {{item.checkResult == '1' ? '符合要求' : 
                      item.checkResult == '2' ? '不符合要求' : ''}}
                </td>
                <td>
                  <div class="edit-item fl del"
                    authorization-btn="api/devicecheckrecord/selectCheckRecordInfo"
                    ng-click="equipmentInspection.queryInformation(item.id)">
                    <i class="fa fa-search color"></i>
                    <span>查看</span>
                  </div>
                  <div class="edit-item fl del"
                    authorization-btn="api/devicecheckrecord/selectCheckRecordInfo"
                    ng-click="equipmentInspection.editInformation(item.id)">
                    <i class="fa fa-pencil color"></i>
                    <span>编辑</span>
                  </div>
                  <div class="edit-item fl del"
                    authorization-btn="api/devicecheckrecord/deleteCheckRecord"
                    ng-click="equipmentInspection.deleteInformation(item.id)">
                    <i class="fa fa-trash color"></i>
                    <span>删除</span>
                  </div>
                </td>
              </tr>
            </tbody>
          </table>
        </form>

        <div class="total-num">
          共计<span class="total-num-colorful">
          {{equipmentInspection.paginationData.total}}</span>条
        </div>
        <!-- 分页 -->
        <div class="pagination-outer">
          <uib-pagination
            total-items="equipmentInspection.paginationData.total"
            ng-model="equipmentInspection.paginationData.pageNum"
            items-per-page="equipmentInspection.paginationData.pageSize"
            ng-change="pageChange()"
            class="pagination-sm"
            boundary-link-numbers="true"
            max-size="5"
            next-text="下一页"
            previous-text="上一页"></uib-pagination>
        </div>
      </div>
    </div>
  </div>
</div>

<!-- 查看检测记录 -->
<script type="text/ng-template" id="queryEquipmentInspection">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>查看检测记录</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <div style="height:188px;">
        <div class="row-item">
          <div class="fixed-left-label">所属标段：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.tender}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">设备等级：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.deviceLevel == '1' ? '一般设备' : 
               vm.editInfo.deviceInfoBean.deviceLevel == '2' ? '主要设备' : 
               vm.editInfo.deviceInfoBean.deviceLevel == '4' ? '特种设备' : ''}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">设备名称：</div>
          <div class="right-value">
            {{vm.editInfo.deviceInfoBean.deviceName}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">内部编号：</div>
          <div class="right-value"> 
            {{vm.editInfo.deviceInfoBean.innerNo}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">检测时间：</div>
          <div class="right-value">
             {{vm.editInfo.checkTime}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">下次检测时间：</div>
          <div class="right-value">
            {{vm.editInfo.nextChecktime}}
          </div>
        </div>
        <div class="row-item">
          <div class="fixed-left-label">检测结果：</div>
          <div class="right-value"> 
            {{vm.editInfo.checkResult == '1' ? '符合要求' : 
            vm.editInfo.checkResult == '2' ? '不符合要求' : ''}}
          </div>
        </div>
      </div>
      <div style="float: left;width: 150px;"
        ng-repeat = "item in vm.editInfo.fileBeans">
        <!-- 展示头像和文件 -->
        <div class="avatar-attachment-upload-outer"
          >
          <img class="avatar-img" style="width: 100px;height: 150px" 
            ng-src="{{vm.getAvatarSrc(item)}}"/>
          <a class="pa-btn file-del-btn" target="_blank" 
            ng-href="{{vm.getDownloadSrc(item)}}">
              下载
          </a>
        </div>
      </div>
    </div>
  </div>
</script>

<!-- 新增检测记录 -->
<script type="text/ng-template" id="equipmentInspection">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>新增检测记录</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="addForm" novalidate>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>牌照：</div>
          <div class="right-value">
            <input type="text" name="license" required 
              ng-model="addTextCode.addItem.deviceInfoBean.license"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.license.$dirty) && addForm.license.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="checkTime" required 
              ng-model="addTextCode.addItem.checkTime"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.checkTime.$dirty) && addForm.checkTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>下次检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="nextChecktime" required
              ng-model="addTextCode.addItem.nextChecktime"/>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.nextChecktime.$dirty) && addForm.nextChecktime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测结果：</div>
          <div class="right-value"> 
            <div class="line test-results">
              <input class="test-form-control" name="result" required
                type="radio" value="1"
                ng-model="addTextCode.addItem.checkResult"/>符合要求
            </div>
            <div class="line test-results">
              <input class="test-form-control" name="result" required
                type="radio" value="2"
                ng-model="addTextCode.addItem.checkResult"/>不符合要求
            </div>
          </div>
          <span class="error-tip"
            ng-show="(addForm.$submitted || addForm.result.$dirty) && addForm.result.$error.required">
            必填
          </span>
        </div>
        <div>
          <common-attachment-upload
            component-id="cp2"
            file-type="image"
            pick-btn-id="avatar_attachment_picker"
            upload-url="{{fileUploadUrl.deviceCheckRecord}}"
            file-list="addTextCode.attachments">
          </avatar-attachment-upload>
        </div>
      </form>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="addTextCode.submit(addForm)">
        <i class="fa fa-save"></i>
        <span class="ml5">确定</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>

<!--编辑检测信息-->
<script type="text/ng-template" id="editequipment">
  <div class="item-detail-dialog training-tech">
    <div class="item-detail-dialog-header">
      <div class="title-txt">
        <span>编辑检测信息</span>
      </div>
    </div>
    <div class="item-detail-dialog-content">
      <form name="editForm" novalidate>
        <div desc="autofocus-input">
          <input type="text" autofocus="true"  style="opacity: 0;width: 0; height: 0;" />
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="checkTime" required
              ng-model="editInfo.checkTime"/>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.checkTime.$dirty) && editForm.checkTime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>下次检测时间：</div>
          <div class="right-value">
            <input type="text" ng-datepicker name="nextChecktime" required
              ng-model="editInfo.nextChecktime"/>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.nextChecktime.$dirty) && editForm.nextChecktime.$error.required">
            必填
          </span>
        </div>
        <div class="row-item">
          <div class="fixed-left-label"><b>*</b>检测结果：</div>
          <div class="right-value">
            <div class="line test-results">
              <input class="test-form-control" type="radio" value="1"
                name="checkResult" required
                ng-model="editInfo.checkResult"/>符合要求
            </div>
            <div class="line test-results">
              <input class="test-form-control" type="radio" value="2"
                name="checkResult" required
                ng-model="editInfo.checkResult"/>不符合要求
            </div>
          </div>
          <span class="error-tip"
            ng-show="(editForm.$submitted || editForm.checkResult.$dirty) && editForm.checkResult.$error.required">
            必填
          </span>
        </div>
        <div>
          <common-attachment-upload
            component-id="edit_inspection"
            file-type="image"
            pick-btn-id="edit_inspection_upload_btn"
            upload-url="{{fileUploadUrl.deviceCheckRecord}}"
            file-list="editInfo.fileBeans">
          </avatar-attachment-upload>
        </div>
      </form>
    </div>
    <div class="item-detail-dialog-footer">
      <a class="pa-btn" ng-click="this.submit(editForm)">
        <i class="fa fa-save"></i>
        <span class="ml5">确定</span>
      </a>
      <a class="pa-btn" ng-click="closeThisDialog()">
        <i class="fa fa-times"></i>
        <span class="ml5">取消</span>
      </a>
    </div>
  </div>
</script>